package learn.easymock.test.com;

import static org.easymock.EasyMock.createMock;
import static org.junit.Assert.assertEquals;
import learn.esymock.object.com.Aclass;
import learn.esymock.object.com.Bclass;
import learn.esymock.object.com.Cclass;

import org.easymock.EasyMock;
import org.junit.Ignore;
import org.junit.Test;

public class DemoEasymock {

	private Aclass aClassMock = createMock(Aclass.class);
	private Bclass bClassMock = createMock(Bclass.class);

	@Test
	public void test(){
		Cclass cclass = new Cclass();
		
		EasyMock.expect(aClassMock.getA1()).andReturn(10).anyTimes();
		EasyMock.expect(bClassMock.getB1()).andReturn(10).anyTimes();
		EasyMock.replay(aClassMock,bClassMock);
		int rs = cclass.process2(aClassMock, bClassMock);
		assertEquals(rs, 20);
		
		EasyMock.verify(aClassMock, bClassMock);
	}

}
